﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PassengerTripDetail.aspx.cs"
    Inherits="TripLOA.GUI.PassengerTripDetail" MasterPageFile="~/GUIMaster.Master"
    meta:resourcekey="Page" %>

<%@ Register Assembly="MapControl2" Namespace="MapControl2" TagPrefix="map2" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="PeriodicTripControl/PeriodicTrip.ascx" TagName="PeriodicTrip" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>Trip Detail</title>
    
    <link href="/PeriodicTripControl/periodicTrip.css" type="text/css" rel="stylesheet" />

        <script type="text/javascript" src="/PeriodicTripControl/periodicTrip.js"></script>
    
    <link href="../createTrip/resources/createTrip.css" rel="stylesheet" type="text/css" />
    <link href="PassengerTripDetail/PassengerTripDetail.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="common/geoCodingMenu/AAAGeoCodingMenu.js"></script>
   
    <script type="text/javascript">
    
    var startTextBox = null;
    var endTextBox = null;
   
   /*View a error message if the field is empty.
    *Return false if the field is empty else return true
    */ 
   function validateField(id){
    
        var n;
        var err;
        var msg = document.getElementById("<%= NoValueMsg.ClientID %>");
        switch(id){
            //for start point
            case 0:
                n = document.getElementById("<%= startPoint.ClientID %>");
                err = document.getElementById("<%=startError.ClientID %>");
                break;
            //for start tolerance
            case 1:
                n = document.getElementById("<%= startPointTolerance.ClientID %>");
                err = document.getElementById("<%=startTolError.ClientID %>");
                break;
            //for end point
            case 2:
                n = document.getElementById("<%= endPoint.ClientID %>");
                err = document.getElementById("<%=endError.ClientID %>");
                break;
            //for end tolerance
            case 3:
                n = document.getElementById("<%= endPointTolerance.ClientID %>");
                err = document.getElementById("<%=endTolError.ClientID %>");
                break;
            //for the seat number
            case 4:
                n = document.getElementById("<%= noSeats.ClientID %>");
                err = document.getElementById("<%=seatError.ClientID %>");
                break;
        }
        
        if(n.value == ""){
           viewMessage(err, msg.value);
           return false;
        }else{
           hideMessage(err);
           return true;
        }
    
    }
   
    function viewMessage(err, msg){
        
        err.innerHTML = msg;
        err.style.fontSize="10pt";           
        err.style.visibility="visible";
    }
    
    function hideMessage(err){
        err.style.fontSize="1pt";
        err.style.visibility="hidden";
    }
    
    /*View the correct error message if the requested seat value is:
     * 1. empty
     * 2. > of the free seat
     * 3. = 0
     */
    function validateSeat(free, th_is_FreeSeat){
            if(th_is_FreeSeat != 0){
                var n = document.getElementById("<%= noSeats.ClientID %>");
                var err = document.getElementById("<%= seatError.ClientID %>");
                var msgBefore = document.getElementById("<%= BeforeMsg.ClientID %>");
                var msgAfter = document.getElementById("<%= AfterMsg.ClientID %>");
                var msgOnlyOne = document.getElementById("<%= OnlyOne.ClientID %>");
                var reqSeats = n.value;
                var msg = msgBefore.value + free + msgAfter.value;
                        
                if(validateField(4) && (free < reqSeats || reqSeats == 0)){
                    if(free < reqSeats && free == 1)
                        msg = msgOnlyOne.value;
                    viewMessage(err, msg);
                }
            }
    }      
    </script>

     <!-- Georef GeoCodingMenu integration -->
    <script type="text/javascript">
        function bindCoords() {
            
            var departureTxt = document.getElementById("<%=startPoint.ClientID%>");
            var arriveTxt = document.getElementById("<%=endPoint.ClientID%>");
            var departureCoords = document.getElementById("<%=latlongStart.ClientID%>");
            var arriveCoords = document.getElementById("<%=latlongEnd.ClientID%>");
            
            if (departureTxt.latitude && departureTxt.longitude && departureTxt.latitude != "-1" && departureTxt.longitude != "-1") {
                departureCoords.setAttribute("value", departureTxt.latitude + "," + departureTxt.longitude);
                
            } else if (departureCoords.defaultValue != "") {
                departureCoords.setAttribute("value", departureCoords.defaultValue);
                
            } else {
                
                validateField(0);
                departureTxt.focus();
                return false;
            }
            
            if (arriveTxt.latitude && arriveTxt.longitude && arriveTxt.latitude != "-1" && arriveTxt.longitude != "-1") {
                arriveCoords.setAttribute("value", arriveTxt.latitude + "," + arriveTxt.longitude);
            } else if (arriveCoords.defaultValue != "") {
                arriveCoords.setAttribute("value", arriveCoords.defaultValue);
            } else {
                validateField(2);
                arriveTxt.focus();
                return false;
            }
        }
    </script>

    <!-- end GeoRef -->

    <script type="text/javascript">
     //control if the field are not empty and do the GeoCoding of the start and end point
     function isCorrect(){
        var err = document.getElementById("<%= errorsMessage.ClientID %>");
        if(!validateField(0) || !validateField(1) || !validateField(2) || !validateField(3)
            || !validateField(4)){
             
             viewMessage(err, '<%= this.GetGlobalResourceObject("TripLoaResource","NotCorrectParPTD") %>')
             return false;
         }
         bindCoords();
                        
    }   
    
    </script>
    

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentHomePage" runat="server">
    <h1>
        <asp:Label ID="labelPTripDetail2" runat="server" meta:resourcekey="labelPTripDetail2"></asp:Label>
    </h1>
    <asp:HiddenField ID="NoValueMsg" runat="server" Value="<%$Resources:TripLoaResource, errorEmptyFieldPTD%>" />
    <asp:HiddenField ID="BeforeMsg" runat="server" Value="<%$Resources:TripLoaResource, errorSeatsBeforePTD%>" />
    <asp:HiddenField ID="AfterMsg" runat="server" Value="<%$Resources:TripLoaResource, errorSeatsAfterPTD%>" />
    <asp:HiddenField ID="OnlyOne" runat="server" Value="<%$Resources:TripLoaResource, error1SeatsPTD%>" />
    <div id="content_detail_Trip">
        <cc1:DragPanelExtender ID="DragPanelExtender1" runat="server" TargetControlID="contentPanel"
            DragHandleID="headerPanel" />
        <div id="content_map_drag">
            <asp:Panel ID="contentPanel" runat="server" CssClass="Panel_move_map">
                <asp:Panel ID="headerPanel" runat="server">
                    <div id="header_map">
                    </div>
                    <div id="content_map">
                        <div id="mapDiv">
                        </div>
                    </div>
                    <div id="footer_map">
                    </div>
                </asp:Panel>
            </asp:Panel>
        </div>
       
        <div id="viewTripDetail" runat="server">
            <asp:Panel ID="TripDetailHeaderPanel" runat="server" CssClass="CollapsiblePanelHeader">
                
                <asp:Image ID="ImageDetail" runat="server" meta:resourcekey="showDetail" />
            </asp:Panel>
            <asp:Panel ID="tripDetailContentPanel" runat="server" CssClass="CollapsiblePanelContent">
                <asp:DetailsView ID="tripDetailsView" runat="server" Width="350px" AutoGenerateRows="False"
                    AlternatingRowStyle-BorderStyle="None" BorderStyle="None" CommandRowStyle-BorderStyle="None"
                    EditRowStyle-BorderStyle="None" EmptyDataRowStyle-BorderStyle="None" FieldHeaderStyle-BorderStyle="None"
                    FooterStyle-BorderStyle="None" HeaderStyle-BorderStyle="None" InsertRowStyle-BorderStyle="None"
                    PagerStyle-BorderStyle="None" RowStyle-BorderStyle="None" GridLines="None" meta:resourcekey="noTrip" OnPreRender="tripDetail_PreRender">
                    <FooterStyle BorderStyle="None"></FooterStyle>
                    <CommandRowStyle BorderStyle="None"></CommandRowStyle>
                    <RowStyle BorderStyle="None"></RowStyle>
                    <FieldHeaderStyle BorderStyle="None"></FieldHeaderStyle>
                    <EmptyDataRowStyle BorderStyle="None"></EmptyDataRowStyle>
                    <PagerStyle BorderStyle="None"></PagerStyle>
                    <Fields>
                        <asp:TemplateField meta:resourcekey="detailUserId" HeaderStyle-CssClass="label_title"
                            HeaderStyle-Height="30px">
                            <ItemTemplate>
                                <asp:HyperLink ID="AuthLink" runat="server">  </asp:HyperLink>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="Departure" ReadOnly="True" SortExpression="Departure"
                            meta:resourcekey="detailDeparture" HeaderStyle-CssClass="label_title" HeaderStyle-Height="30px"
                            HeaderStyle-Width="100px" />
                        <asp:BoundField DataField="Arrival" ReadOnly="True" SortExpression="Arrival" meta:resourcekey="detailArrival"
                            HeaderStyle-CssClass="label_title" HeaderStyle-Height="30px" HeaderStyle-Width="150px" />
                        <asp:TemplateField meta:resourcekey="detailVehicle" HeaderStyle-CssClass="label_title"
                            HeaderStyle-Height="30px" HeaderStyle-Width="150px">
                            <ItemTemplate>
                                <asp:Label ID="vehicle" runat="server"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField meta:resourcekey="detailDepartureDate" HeaderStyle-CssClass="label_title"
                            HeaderStyle-Height="30px" HeaderStyle-Width="150px">
                            <ItemTemplate>
                                <asp:Label ID="departureDate" runat="server"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="FreeSeats" ReadOnly="True" SortExpression="FreeSeats"
                            HeaderStyle-CssClass="label_title" HeaderStyle-Height="30px" HeaderStyle-Width="150px"
                            meta:resourcekey="detailFreeSeats" />
                        <asp:BoundField DataField="ReservationExpirationDate" ReadOnly="True" SortExpression="ReservationExpirationDate"
                            HeaderStyle-CssClass="label_title" HeaderStyle-Height="30px" HeaderStyle-Width="150px"
                            meta:resourcekey="detailReservationExpirationDate" NullDisplayText="-" />
                                                    
                        <asp:TemplateField meta:resourcekey="detailEstimatedBudget" HeaderStyle-CssClass="label_title"
                            HeaderStyle-Height="30px" HeaderStyle-Width="150px">
                            <ItemTemplate>
                                
                                <%#(Eval("EstimatedBudget") != null ? Convert.ToDecimal(Eval("EstimatedBudget")).ToString("0.00") + " €" : "-")%>
                            </ItemTemplate>
                        </asp:TemplateField>
                       
                        <asp:TemplateField meta:resourcekey="detailEstimatedTime" HeaderStyle-CssClass="label_title"
                            HeaderStyle-Height="30px" HeaderStyle-Width="150px">
                            <ItemTemplate>
                                    <%#(Eval("EstimatedTime") != null ? Eval("EstimatedTime") + " min" : "-")%>
                                   
                                    
                            </ItemTemplate>
                        </asp:TemplateField>     
                        
                        <asp:TemplateField meta:resourcekey="detailDeviationRadius" HeaderStyle-CssClass="label_title"
                            HeaderStyle-Height="30px" HeaderStyle-Width="150px">
                            <ItemTemplate>
                                    <%#(Eval("DeviationRadius") != null ? Eval("DeviationRadius") + " km" : "-")%>
                            </ItemTemplate>
                        </asp:TemplateField>    
                        
                        <asp:CheckBoxField DataField="isFrequent" ReadOnly="True" SortExpression="isFrequent"
                            HeaderStyle-CssClass="label_title" HeaderStyle-Height="30px" HeaderStyle-Width="150px"
                            meta:resourcekey="detailFrequency" />
                        <asp:TemplateField meta:resourcekey="detailFrequencyFrom" HeaderStyle-CssClass="label_title"
                            HeaderStyle-Height="30px" HeaderStyle-Width="150px">
                            <ItemTemplate>
                                <asp:Label ID="FromLabel" runat="server"><%#Eval("FrequencyDetails.From")%></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField meta:resourcekey="detailFrequencyTo" HeaderStyle-CssClass="label_title"
                            HeaderStyle-Height="30px" HeaderStyle-Width="150px">
                            <ItemTemplate>
                                <asp:Label ID="ToLabel" runat="server"><%#Eval("FrequencyDetails.To")%></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderStyle-CssClass="label_title" HeaderStyle-Height="30px" HeaderStyle-Width="150px">
                            <ItemTemplate>
                                <input id="showit" class="button_generics" type="button" value="<%= this.GetGlobalResourceObject("TripLoaResource","showFrequency") %>" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:CheckBoxField DataField="AcceptSmoker" ReadOnly="True" SortExpression="AcceptSmoker"
                            HeaderStyle-CssClass="label_title" HeaderStyle-Height="30px" HeaderStyle-Width="150px"
                            meta:resourcekey="detailAcceptSmoker" />
                        <asp:CheckBoxField DataField="RequireLicenced" ReadOnly="True" SortExpression="RequireLicenced"
                            HeaderStyle-CssClass="label_title" HeaderStyle-Height="30px" HeaderStyle-Width="150px"
                            meta:resourcekey="detailRequireLicenced" />
                        <asp:CheckBoxField DataField="Accomplished" ReadOnly="True" SortExpression="Accomplished"
                            meta:resourcekey="detailAccomplished" HeaderStyle-CssClass="label_title" HeaderStyle-Height="30px"
                            HeaderStyle-Width="100px" />
                        <asp:CheckBoxField DataField="Draft" ReadOnly="True" SortExpression="Draft" meta:resourcekey="detailDraft"
                            HeaderStyle-CssClass="label_title" HeaderStyle-Height="30px" HeaderStyle-Width="100px" />
                        <asp:TemplateField meta:resourcekey="detailRealBudeget" HeaderStyle-CssClass="label_title"
                            HeaderStyle-Height="30px" HeaderStyle-Width="150px">
                            <ItemTemplate>
                                
                                <%#(Eval("RealBudget") != null ? Convert.ToDecimal(Eval("RealBudget")).ToString("0.00") + " €" : "-")%>
                               
                                
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField meta:resourcekey="detailRealTime" HeaderStyle-CssClass="label_title"
                            HeaderStyle-Height="30px" HeaderStyle-Width="150px">
                            <ItemTemplate>
                                    <%#(Eval("RealTime") != null ? Eval("RealTime") + " min" : "-")%>
                            </ItemTemplate>
                        </asp:TemplateField>   
                            
                        <asp:TemplateField meta:resourcekey="detailNote" HeaderStyle-CssClass="label_title"
                            HeaderStyle-Height="30px" HeaderStyle-Width="150px">
                            <ItemTemplate>
                                <asp:Label ID="Notes" runat="server"><%#Eval("Notes") %></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Fields>
                    <HeaderStyle BorderStyle="None"></HeaderStyle>
                    <InsertRowStyle BorderStyle="None"></InsertRowStyle>
                    <EditRowStyle BorderStyle="None"></EditRowStyle>
                    <AlternatingRowStyle BorderStyle="None"></AlternatingRowStyle>
                </asp:DetailsView>
            </asp:Panel>
        </div>
        <div id="viewStages" runat="server">
            <asp:Panel ID="stagesHeaderPanel" runat="server" CssClass="CollapsiblePanelHeader">
                
                <asp:Image ID="StagesImage" runat="server" meta:resourcekey="showStages" />
            </asp:Panel>
            <asp:Panel ID="stagesPanel" runat="server" CssClass="CollapsiblePanelContent">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <asp:GridView ID="detailViewStages" runat="server" Width="350px" AutoGenerateColumns="false"
                            AllowPaging="true" PageSize="2" BorderStyle="None" GridLines="None" OnPageIndexChanging="detailViewStages_PageIndexChanging"
                            OnPreRender="stages_PreRender">
                            <PagerSettings Mode="NumericFirstLast" />
                            <Columns>
                                <asp:TemplateField meta:resourcekey="detailDeparture" HeaderStyle-CssClass="label_title"
                                    ItemStyle-VerticalAlign="Middle" ItemStyle-Width="35%">
                                    <ItemTemplate>
                                        <asp:Label ID="origin" runat="server"></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField meta:resourcekey="detailArrival" HeaderStyle-CssClass="label_title"
                                    ItemStyle-VerticalAlign="Middle" ItemStyle-Width="35%">
                                    <ItemTemplate>
                                        <asp:Label ID="destination" runat="server"></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
         
                                
                                <asp:TemplateField meta:resourcekey="stagesEstimatedTime" HeaderStyle-CssClass="label_title"
                                    ItemStyle-VerticalAlign="Middle" ItemStyle-Width="15%">
                                    <ItemTemplate>
                                        
                                        <%#(Eval("EstimatedTime") != null ? Eval("EstimatedTime") + " min" : "-")%>   
                                     </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField meta:resourcekey="detailDistance" HeaderStyle-CssClass="label_title"
                                    ItemStyle-VerticalAlign="Middle" ItemStyle-Width="15%">
                                    <ItemTemplate>
                                        <%#(Eval("Distance") != null ? Convert.ToDouble(Eval("Distance")).ToString("0.00") + " km" : "-")%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                
                                
                            </Columns>
                        </asp:GridView>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </asp:Panel>
        </div>
       
        <div id="viewPassengersList" runat="server">
            <asp:Panel ID="passengersPanelHeader" runat="server" CssClass="CollapsiblePanelHeader">
                <asp:Image ID="PassengersImage" runat="server" meta:resourcekey="showPassengers" />
            </asp:Panel>
            <asp:Panel ID="passengersPanel" runat="server" CssClass="CollapsiblePanelContent">
                <asp:DataList ID="passengerList" runat="server" OnPreRender="passengers_PreRender">
                    <HeaderTemplate>
                        <asp:Label ID="noPassenger" meta:resourcekey="labelNoPassenger" runat="server" OnInit="noPassenger_OnInit"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        
                         <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# "../secure/userProfile.aspx?Nick=" +  Eval("Username") %>'><%# Eval("Username")%></asp:HyperLink>                 
                    </ItemTemplate>
                </asp:DataList>
            </asp:Panel>
        </div>
        
       
        <br />
        <br />
       
        <asp:Panel ID="presencePanel" runat="server" >
            <!-- header -->
            <div id="rrHeader">
                <div id="rrTopLeftCorner">
                </div>
                <div id="rrTopBorder">
                    <asp:Literal ID="ReservationTitle" meta:resourcekey="labelPTripDetail3" runat="Server" /></div>
                <div id="rrTopRightCorner">
                </div>
            </div>
            <!-- content -->
            <div id="rrContent">
            
                    <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                    <ProgressTemplate>
                    <div id="loader_friends">
                        <img alt="Loading please wait" src="../master/resourcesNew/img/loader.gif" />
                           <asp:Label ID="lbl_loader" runat="server" CssClass="lbl_strong" Text="Load..."></asp:Label></div>
                        </ProgressTemplate>
                    
                    </asp:UpdateProgress>
                
                    <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="buttonJoin"/>
                         
                        </Triggers>
                        <ContentTemplate>
                            <asp:Label ID="errorsMessage" runat="server" Text="Label" ForeColor="Red" Visible = "false"></asp:Label> 
                        </ContentTemplate>
                    </asp:UpdatePanel>
                    
                    <div id="showThisForm" runat="server">
                        <asp:Table ID="PresenceTable1" runat="server" Width="320px">
                            <asp:TableRow>
                                <asp:TableCell Width="10em">
                                    <asp:Label ID="startLabel" runat="server" CssClass="label_title" meta:resourcekey="startLabel"></asp:Label>
                                </asp:TableCell>
                                <asp:TableCell>
                                    <asp:TextBox ID="startPoint" runat="server"></asp:TextBox>
                                    <asp:HiddenField ID="latlongStart" runat="server" />
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow>
                                <asp:TableCell Width="16em">
                                </asp:TableCell>
                                <asp:TableCell>
                                    <asp:Label ID="startError" runat="server" CssClass="errorMsg"></asp:Label>
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow>
                                <asp:TableCell>
                                    <asp:Label ID="startTolerance" runat="server" CssClass="label_title" meta:resourcekey="tolerance"></asp:Label>
                                </asp:TableCell>
                                <asp:TableCell>
                                    <asp:UpdatePanel ID="startTolUP" runat="server">
                                        <ContentTemplate>
                                            <asp:TextBox ID="startPointTolerance" runat="server" Width="4em" MaxLength="4" onchange="validateField(1)"></asp:TextBox>
                                            <asp:Label ID="Label1" runat="server" Text="km" CssClass="label_title"></asp:Label>
                                            <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" runat="server" FilterType="Custom"
                                                TargetControlID="startPointTolerance" ValidChars="0123456789,">
                                            </cc1:FilteredTextBoxExtender>
                                        </ContentTemplate>
                                    </asp:UpdatePanel>
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow>
                                <asp:TableCell>
                                </asp:TableCell>
                                <asp:TableCell>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidatorStartPoint" runat="server" meta:resourcekey="startTolerance" ValidationExpression="^\d+(\,\d*)?$" ControlToValidate="startPointTolerance" Display="Dynamic" SetFocusOnError="True"></asp:RegularExpressionValidator>
                                    <asp:Label ID="startTolError" runat="server" CssClass="errorMsg"></asp:Label>
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow>
                                <asp:TableCell>
                                    <asp:Label ID="endLabel" runat="server" CssClass="label_title" meta:resourcekey="endLabel"></asp:Label>
                                </asp:TableCell>
                                <asp:TableCell>
                                    <asp:TextBox ID="endPoint" runat="server"></asp:TextBox>
                                    <asp:HiddenField ID="latlongEnd" runat="server" />
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow>
                                <asp:TableCell>
                                </asp:TableCell>
                                <asp:TableCell>
                                    <asp:Label ID="endError" runat="server" CssClass="errorMsg"></asp:Label>
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow>
                                <asp:TableCell>
                                    <asp:Label ID="endTolerance" runat="server" CssClass="label_title" meta:resourcekey="tolerance"></asp:Label>
                                    
                                </asp:TableCell>
                                <asp:TableCell>
                                    <asp:UpdatePanel ID="endTolUP" runat="server">
                                        <ContentTemplate>
                                            <asp:TextBox ID="endPointTolerance" runat="server" Width="4em" MaxLength="4" onchange="validateField(3)"></asp:TextBox>
                                            <asp:Label ID="km" runat="server" Text="km" CssClass="label_title"></asp:Label>
                                            <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender2" FilterType="Custom" FilterMode="ValidChars" ValidChars="0123456789," TargetControlID="endPointTolerance"
                                                runat="server">
                                            </cc1:FilteredTextBoxExtender>
                                            
                                        </ContentTemplate>
                                    </asp:UpdatePanel>
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow>
                                <asp:TableCell>
                                </asp:TableCell>
                                <asp:TableCell>
                                    <asp:RegularExpressionValidator ID="RegularExpressionValidatorEndPoint" runat="server" meta:resourcekey="endTolerance" ValidationExpression="^\d+(\,\d*)?$" ControlToValidate="endPointTolerance" Display="Dynamic" SetFocusOnError="True"></asp:RegularExpressionValidator>
                                    <asp:Label ID="endTolError" CssClass="errorMsg" runat="server"></asp:Label>
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow>
                                <asp:TableCell>
                                    <asp:Label ID="noSeatLabel" runat="server" Width="4em" CssClass="label_title" meta:resourcekey="noSeatsLabel"></asp:Label>
                                </asp:TableCell>
                                <asp:TableCell>
                                    <asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional">
                                        <ContentTemplate>
                                            <asp:TextBox ID="noSeats" runat="server" Width="3em" MaxLength="3"></asp:TextBox>
                                            <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" FilterType="Numbers" TargetControlID="noSeats"
                                                runat="server" InvalidChars=".">
                                            </cc1:FilteredTextBoxExtender>
                                        </ContentTemplate>
                                    </asp:UpdatePanel>
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow>
                                <asp:TableCell>
                                </asp:TableCell>
                                <asp:TableCell>
                                    <asp:Label ID="seatError" runat="server" CssClass="errorMsg"></asp:Label>
                                </asp:TableCell>
                            </asp:TableRow>
                        </asp:Table>
                        <asp:UpdatePanel ID="presenceUP" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <map2:LOAMap ID="map2_id" runat="server" MapDiv="mapDiv" Editable="false" TargetControlIDs="ctl00_ContentHomePage_buttonJoin"
                                    ZoomLevel="10" Visible="false"/>
                                <asp:Table ID="PresenceTable2" runat="server" Width="360px">
                                    <asp:TableRow>
                                        <asp:TableCell Width="10em">
                                        </asp:TableCell>
                                        <asp:TableCell>
                                            <asp:LinkButton ID="UpdateMap" runat="server" OnClientClick="isCorrect()" OnClick="UpdateMap_Click" meta:resourcekey="buttonUpdateMap"></asp:LinkButton>
                                        </asp:TableCell>
                                    </asp:TableRow>
                                </asp:Table>
                                <h2>
                                    <asp:Label ID="labelPTripDetail4" runat="server" meta:resourcekey="labelPTripDetail4"></asp:Label>
                                </h2>
                                <asp:TextBox ID="tripComment" runat="server" TextMode="MultiLine" OnTextChanged="tripComment_TextChanged"
                                    Width="320px" Height="5em"></asp:TextBox>
                                <br />
                                
                            </ContentTemplate>
                        </asp:UpdatePanel>
                        <asp:Button ID="buttonJoin" runat="server" OnClientClick="isCorrect()" OnClick="buttonJoin_Click"
                                    meta:resourcekey="buttonJoin" CssClass="button_generics"/>
                    </div>
                    <!--GeoRef-->

                    <script type="text/javascript">
                            mapStrings["start_info_route"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeosInfoRoute") %>';
                            mapStrings["startDescr_info_route"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeosDescrInfoRoute") %>';
                            mapStrings["end_info_route"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoeInfoRoute") %>';
                            mapStrings["endDescr_info_route"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoeDescrInfoRoute") %>';
                            mapStrings["dist_info_route"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoDistInfoRoute") %>';
                            mapStrings["time_info_route"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoTimeInfoRoute") %>';
                            mapStrings["wayNumb_info_route"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeonWayInfoRoute") %>';
                            mapStrings["title_info_route"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoTitleInfoRoute") %>';
                            
                            mapStrings["start_info_trip"]='<%=this.GetGlobalResourceObject("TripLoaResource","GeosInfoTrip") %>';
                            mapStrings["startDescr_info_trip"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeosDescrInfoTrip") %>';
                            mapStrings["end_info_trip"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoeInfoTrip") %>';
                            mapStrings["endDescr_info_trip"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoeDescrInfoTrip") %>';
                            mapStrings["dist_info_trip"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoDistInfoTrip") %>';
                            mapStrings["time_info_trip"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoTimeInfoTrip") %>';
                            mapStrings["routeN_info_trip"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeonRoutesInfoTrip") %>';
                            mapStrings["title_info_trip"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoTitleInfoTrip") %>';
                            
                            mapStrings["endLabel_trip"]='<%=this.GetGlobalResourceObject("TripLoaResource","GeoEndLabel") %>';
                            mapStrings["end_trip"]='<%=this.GetGlobalResourceObject("TripLoaResource","GeoEndTrip") %>';
                            mapStrings["endDescr_trip"]='<%=this.GetGlobalResourceObject("TripLoaResource","GeoEndDescr") %>';

                            mapStrings["waypointLabel"]= '<%=this.GetGlobalResourceObject("TripLoaResource","GeoWayLabel") %>';
                            mapStrings["waypoint_Location"]='<%=this.GetGlobalResourceObject("TripLoaResource","GeoWayLoc") %>';
                            mapStrings["waypoint_Descr"]='<%=this.GetGlobalResourceObject("TripLoaResource","GeoWayDescr") %>';
                            
                            mapStrings["passengers_in"]  ='<%= this.GetGlobalResourceObject("TripLoaResource","GeoPassIn") %>';
                            mapStrings["passengers_off"] ='<%= this.GetGlobalResourceObject("TripLoaResource","GeoPassOff") %>'; 
                        
                            var departureId = "<%=startPoint.ClientID%>";
                            var arriveId = "<%=endPoint.ClientID%>";
                            var departureHiddenId = "<%=latlongStart.ClientID%>";
                            var arriveHiddenId = "<%=latlongEnd.ClientID%>";
                                                
                            Sys.Application.add_load(initializeElements);
                            function initializeElements(){
                                startTextBox = $get(departureId);
                                endTextBox = $get(arriveId);
                                startHidden = $get(departureHiddenId);
                                endHidden = $get(arriveHiddenId);
                                initializeGeocodingMenu();
                                registerHandlers();
                            };  
                    
                            function initializeGeocodingMenu(){
                                GUI.AAAGeoCodingMenu(startTextBox, GUI.AAAGeoCodingMenu.RIGHT, GUI.AAAGeoCodingMenu.UP);
                                GUI.AAAGeoCodingMenu(endTextBox);
                                startCoords = startHidden.value.split(",");
                                startTextBox.latitude = parseFloat(startCoords[0]);
                                startTextBox.longitude = parseFloat(startCoords[1]);
                                endCoords = endHidden.value.split(",");
                                endTextBox.latitude = parseFloat(endCoords[0]);
                                endTextBox.longitude = parseFloat(endCoords[1]);
                                startTextBox.geocodeFail='<%= this.GetGlobalResourceObject("TripLoaResource","GeocodFail") %>';
                                startTextBox.locNotFound='<%= this.GetGlobalResourceObject("TripLoaResource","LocFail") %>';
                                endTextBox.geocodeFail='<%= this.GetGlobalResourceObject("TripLoaResource","GeocodFail") %>';
                                endTextBox.locNotFound='<%= this.GetGlobalResourceObject("TripLoaResource","LocFail") %>';
                            };
                            
                            //map-form interaction 
                            function registerHandlers(){
                                var map = Sys.Application.findComponent("ctl00_ContentHomePage_map2_id");
                                if (map._stuff.passengerHandler == null){
                                    map._stuff.passengerHandler = function(marker){
                                        var myBox = (marker._isDeparture)? startTextBox : endTextBox;
                                        myBox.value = '...';
                                        marker.checkPosition(function(){myBox.setGeoloc(marker.getGeoLoc())});
                                    }
                                }
                            }
                            
                                             
                    </script>
            </div>
                      
            
            <!-- footer -->
            <div id="rrFooter">
                <div id="rrBottomLeftCorner">
                </div>
                <div id="rrBottomBorder">
                </div>
                <div id="rrBottomRightCorner">
                </div>
            </div>
        </asp:Panel>
    </div>
       
    <script type="text/javascript">
    
        //for update the position of the GeoCodingMenu
        function updateGeoCodingMenu(){
    
            if(startTextBox!=null || endTextBox!=null){
                if(startTextBox.menuStatus == 1)
                    startTextBox.showMenu();
                  
                if(endTextBox.menuStatus == 1)
                    endTextBox.showMenu();
                               
            }
        }
        //init the collapsible menu
        function initMenu() {
            $('.CollapsiblePanelContent:not(:first)').hide();
            $('.CollapsiblePanelHeader').click(function(){
                $(this).next().slideToggle('normal',updateGeoCodingMenu);
                                                                                   
            });
        }
    
        $(document).ready(function() {initMenu();
        $('#showit').click(showPeriodicTripControl);});
    
    </script>
    
    <map2:LOAMap ID="map1_id" runat="server" MapDiv="mapDiv" Editable="false" TargetControlIDs="ctl00_ContentHomePage_buttonJoin"
                                    ZoomLevel="10" Visible="false"/>
    <uc1:PeriodicTrip ID="ptc" runat="server" />
</asp:Content>